﻿@model IEnumerable<Citi.Scheduler.WebUi.Models.RoutineErrorModel>

<script type="text/javascript">
    $(function () {
        $("#divErrorMore").dialog({ autoOpen: false, modal: true });
    });

    function showErrorDetailsDialog() {
        $("#divErrorMore").dialog('open');
    }
</script>

<table>
    <tr>
        <th>
            OcurredOn
        </th>
        <th>
            ErrorDescription
        </th>
        <th>
            Status
        </th>
        <th>
            Routine Error Type
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.OcurredOn)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ErrorDescription)
        </td>
        <td>
            @item.Status.GetDescription()
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.RoutineErrorType.Name)
        </td>
        <td>
            @Ajax.ActionLink("See emails and history", "ErrorDetails", "RoutineError", new { id = item.Id }, new AjaxOptions{ UpdateTargetId = "divErrorMore", OnComplete = "showErrorDetailsDialog"})
        </td>
    </tr>
    
}

</table>
<div id="divErrorMore"></div>